<?php
include_once 'php/connection.php';
session_start();
if(!isset($_SESSION['nenunnanu_admin']))
{
header("location:admin_login.php");
}
//print_r( $_POST);
if(isset($_POST['save']) && $_POST['save']=='update')
{
  if($_POST['type']=='article')
  $sql="update articles set content='$_POST[content]' where id='$_POST[id]'";
  else if($_POST['type']=='event')
  $sql="update events set description='$_POST[content]' where id='$_POST[id]'";
  else if($_POST['type']=='quote')
  $sql="update quotes set quote='$_POST[content]' where id='$_POST[id]'";
  else if($_POST['type']=='speak')
  $sql="update donor_speak set speak='$_POST[content]' where id='$_POST[id]'";
   else if($_POST['type']=='faq')
  $sql="update faq set answer='".addslashes($_POST[content])."' where id='$_POST[id]'";
  if(!mysql_query($sql))
  {
   echo mysql_error();
  }
  else
  {
    if($_POST['type']=='article')
    header("location:manage.php?type=articles");
    else if($_POST['type']=='event')
     header("location:manage.php?type=events");
     else if($_POST['type']=='quote')
     header("location:manage.php?type=quote");
     else if($_POST['type']=='speak')
     header("location:manage.php?type=speak");
	  else if($_POST['type']=='faq')
     header("location:manage.php?type=faq");
  }
}
?>